import { request } from './http';
import type { Protocol, Tip, RegionOut, RegionAddress, ContactOut, LoginUser } from './types';
import { LoginData } from './user-api';

export function findRegion(regionId: string, adCode: string): Promise<Protocol<RegionAddress>> {
  return request.get<Protocol<RegionOut>>(`/api/region/id`, { regionId, adCode });
}

export function findAddress(language: string, id: string): Promise<Protocol<RegionAddress>> {
  if (!language || language === '') {
    language = 'en';
  }
  return request.get<Protocol<RegionAddress>>(`/api/region/address`, { language, id });
}

export function findRegionContact(regionId: string): Promise<Protocol<ContactOut[]>> {
  return request.get<Protocol<ContactOut[]>>(`/api/region/contact`, { regionId });
}
